package dataModifiers;

import java.util.List;

import inputs.Input;

/**
 * Sum Modifier class
 * Extends Modifier functionality
 * 
 * Outputs the sum of all the given inputs.
 * 
 * @author Dylan James
 *
 */
public class Sum extends Modifier {
	private int singleMin, singleMax;
	
	public Sum(List<Input> inputs)
	{
		super(inputs);
	}
	
	@Override
	protected void Initialize() {		
	}	
	
	protected void Update()
	{
		if (!getRun())
			value = 0;
		else
		{
			this.min = singleMin * runCount;
			this.max = singleMax * runCount;
		}
		for (Input input : inputs)
		{
			value += input.getValue();
		}
	}
	
	protected void AccountForInputs()
	{
		min = 0;
		max = 0;
		for (Input input : inputs)
		{
			min += input.getMin();
			max += input.getMax();
		}
		
		singleMin = min;
		singleMax = max;
	}


}
